package com.xiao.mall.foundation.lock;

public class CloseableLock implements AutoCloseable {
    private final SimpleRedisLock lock;
    private final String lockKey;
    private final String lockValue;

    public CloseableLock(SimpleRedisLock lock, String lockKey, String lockValue) {
        this.lock = lock;
        this.lockKey = lockKey;
        this.lockValue = lockValue;
    }

    @Override
    public void close() throws Exception {
        lock.unlock(lockKey, lockValue);
    }
}
